/**
 * Copyright (C) 2011-2012 Luca Li Greci
 *
 * This file is part of pojo-creator
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.pojocreator.metamodel;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * 
 * This class represents the model under construction
 * 
 * @author Luca Li Greci
 */
public class MClass {
    private String name;
    private Class < ? > type;
    private Class < ? > belongTo;
    private MType multiplicity;

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the type
     */
    public Class < ? > getType() {
        return type;
    }

    /**
     * @param type the type to set
     */
    public void setType(Class < ? > type) {
        this.type = type;
    }

    /**
     * @return the belongTo
     */
    public Class < ? > getBelongTo() {
        return belongTo;
    }

    /**
     * @param belongTo the belongTo to set
     */
    public void setBelongTo(Class < ? > belongTo) {
        this.belongTo = belongTo;
    }

    /**
     * @return the multiplicity
     */
    public MType getMultiplicity() {
        return multiplicity;
    }

    /**
     * @param multiplicity the multiplicity to set
     */
    public void setMultiplicity(MType multiplicity) {
        this.multiplicity = multiplicity;
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    @Override
    public boolean equals(Object obj) {
        return EqualsBuilder.reflectionEquals(this, obj);
    }

    @Override
    public String toString() {
        return multiplicity + " " + type.getCanonicalName() + " " + belongTo.getCanonicalName() + "." + name;
    }
}
